package com.yuan.model_convenient.repository;

import com.yuan.model_convenient.domain.ConvenientComplaint;
import com.yuan.model_convenient.domain.ConvenientRepair;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.sql.Timestamp;
import java.time.LocalDate;
import java.util.List;

public interface ConvenientComplaintDao extends JpaRepository<ConvenientComplaint, Integer>, JpaSpecificationExecutor<ConvenientComplaint> {

    @Query(value = "select user.nickName from User user where user.id = :userId")
    String findNiceNameByUserId(Long userId);

    @Query(value = "SELECT cr FROM ConvenientRepair cr WHERE DATE(cr.createTime) = :createTime")
    List<ConvenientComplaint> findConvenientComplaintByTime(LocalDate createTime);

}
